package Controlador;

import Modelo.Figuras;
import Modelo.Policia;
import Modelo.Autito;
import java.awt.Rectangle;
import java.io.Serializable;
import java.util.Vector;

public class PeritoColision implements Serializable  {

    	private static final long serialVersionUID = 6L;

Vector<Figuras> todas_las_figuras;
int i;

	public PeritoColision (Vector vf){
            todas_las_figuras = vf;
	}

          public void checkCollisions(Policia p) {

              Rectangle r1 = p.rect();
                    for (Figuras f: this.todas_las_figuras) {
                        if(p!=f){
                          Rectangle r2 = f.rect();
                            if (r1.intersects(r2)) {
                                f.colision(p);
                         }
                    
                   }

              }
             }
          
            public synchronized void checkCollisions(Autito a) {

                          

                   Rectangle r1 = a.rect();
                    for (Figuras f: this.todas_las_figuras) {
                        if(a!=f){
                          Rectangle r2 = f.rect();
                            if (r1.intersects(r2)) {
                                f.colision(a);
                         }
                    }
                    
                   }
             }           
}
